package com.hong.chapter4;

/**
 * Created by hong on 2018/6/1.
 * 循环打印
 */
public class DaemonThread2 {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            Thread innerThread = new Thread(()->{
                try {
                    while (true){
                        System.out.println("Do some thing for health check");
                        Thread.sleep(1_000);
                    }

                }catch (Exception e){
                    e.printStackTrace();
                }
            });
            //innerThread.setDaemon(true);
            innerThread.start();
            try {
                Thread.sleep(1_000);
                System.out.println("T thread finish done.");
            }catch (Exception e){
                e.printStackTrace();
            }
        });

        t.start();
    }
}
